import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { SequelizeModule } from '@nestjs/sequelize';
import { DatabaseModule } from 'src/database/database.module';
import { jwtConstants } from '../auth/constants';
import { AccessoryController } from './controller/accessory.controller';
import { AccessoryEntity } from './entity/accessory.entity';
import { AccessoryProviders } from './provider/accessory.providers';
import { AccessoryService } from './service/accessory.service';

@Module({
  controllers: [AccessoryController],
  imports: [
    DatabaseModule,
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: jwtConstants.expiresSecond }, // token 过期时效
    }),
    SequelizeModule.forFeature([AccessoryEntity]),
  ],
  providers: [
    AccessoryService,
    ...AccessoryProviders,
  ],
  exports: [AccessoryService],
})
export class AccessoryModule {}
